#define _CRT_SECURE_NO_WARNINGS 1
#include"Head.h"
class NumArray {
public:
    NumArray(vector<int>& nums) {
        int n = nums.size();
        sum.resize(n + 1);
        for (int i = 1; i < n + 1; i++)
        {
            sum[i] = sum[i - 1] + nums[i - 1];
        }
    }

    int sumRange(int left, int right) {
        return sum[right + 1] - sum[left];
    }
private:
    vector<int> sum;
};

/**
 * Your NumArray object will be instantiated and called as such:
 * NumArray* obj = new NumArray(nums);
 * int param_1 = obj->sumRange(left,right);
 */
    